<?php

namespace App\Events\AdminLog;

use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class Log
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    /**
     * 所要记录的操作日志信息
     *
     * @var string
     */
    public $message;

    /**
     * 当前登录的用户ID
     *
     * @var int
     */
    public $userId;

    /**
     * 当前登录的用户名
     *
     * @var string
     */
    public $userName;

    /**
     * 当前登录的真实姓名
     *
     * @var string
     */
    public $realName;

    /**
     * 操作前参数
     *
     * @var
     */
    public $params;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct($message, $user = '', $params = '', $type = '')
    {
        $this->userId = $user;
        $this->message = $message;
        $this->type = $type;
        $this->params = $params;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
//        return new PrivateChannel('channel-name');
        return [];
    }
}
